<!--提交审批记录 -->
<template>
  <div class='lanjian-content custom'>
    <div class="tableOperator">
      <div class="input-box">
        <a-range-picker v-model="queryParam.attr" @change="onChange" class='m-r-8' />
        <a-button type="primary" @click="search" class='m-r-8 ClassA'>
          搜索
        </a-button>
        <a-button @click="loadtable" class='ClassA'>
          重置
        </a-button>
      </div>
    </div>
    <a-table
      class="table-box"
      :columns="columns"
      :data-source="dataSource"
      :pagination="pagination"
      @change="tablePaginationChange"
      rowKey="id"
    >
        <span
          slot="action"
          slot-scope="record"
          class="actionbtn">
          <span @click="see(record)">查看</span>
        </span>
    </a-table>
  </div>
</template>

<script>
import {
  getRectificationPlanSpjl,
} from '@/utils/index';

export default {
  name: 'ApprovalHistory',
  props: {
    dataSource: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      // 列
      columns: [
        {
          title: '序号',
          width: 70,
          align: 'center',
          customRender: (text, record, index) => `${index + 1}`,
        },
        {
          title: '提交时间',
          dataIndex: 'uploadTime',
          key: 'uploadTime',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '评审意见',
          dataIndex: 'editor',
          key: 'editor',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '审批说明',
          dataIndex: 'editor',
          key: 'editor',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '附件',
          dataIndex: 'editor',
          key: 'editor',
          align: 'center',
          customRender: (text, record, index) => {
            return <a>{text}</a>;
          },
        },
        {
          title: '审核单位',
          dataIndex: 'editor',
          key: 'editor',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '评审时间',
          dataIndex: 'status',
          key: 'status',
          align: 'center',
          ellipsis: true,
        },
      ],
      queryParam: {
        attr: [],
      },
      // 分页参数
      pagination: {
        current: 1,
        // defaultCurrent: 1,
        total: 0, // 总数
        showSizeChanger: true,
        // 是否可以快速跳转至某页
        showQuickJumper: true,
        pageSizeOptions: ['10', '20', '40', '80', '100'],
        // showTotal: total => '共 ${total} 条', // 分页中显示总的数据
        // hideOnSinglePage: true, // 只有一页时是否隐藏分页器
        pageSize: 10, // 每页条数，所有页设置统一的条数
      },
    };
  },
  mounted() {
    //this.loadtable()
  },
  methods: {
    // 搜索时间选择器
    onChange(date, dateString) {
      this.queryParam.attr = [...dateString];
    },
    tablePaginationChange(pagination) {
      // 重新设置当前页
      this.pagination.current = pagination.current;
      this.pagination.pageSize = pagination.pageSize;
    },
    // 查询反馈意见
    loadtable() {
      this.queryParam.attr = [];
      getRectificationPlanSpjl().then(res => {
        this.dataSource = [...res];
      });
    },
    // 搜索反馈意见
    search() {
      getRectificationPlanSpjl().then(res => {
        let arr = [];
        res.forEach(element => {
          if (this.queryParam.attr[0] <= element.dateOfMeeting && element.dateOfMeeting <= this.queryParam.attr[1]) {
            arr.push(element);
          }
        });
        this.dataSource = [...arr];
      });
    },
    /*查看*/
    see() {

    },
  },
};
</script>
<style lang="less" scoped>
</style>
